
//
//  IManager+SearchAllCity.m
//  RocketProject
//
//  Created by chen jiedan on 13-6-26.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "IManager+SearchAllCity.h"
#import "NetUrlDefines.h"
#import "RequestUtlity.h"
#import "FrameworkRelativeDefines.h"
#import "RCRecommendFoodDataModel.h"
#import "RCSearchAllCityTagDataModel.h"

@implementation IManager (SearchAllCity)
-(int64_t)requestCityID:(NSString *)cityName  withDelegate:(id<IManagerDelegate>)delegate
{
    if (nil == cityName) {
        return kInvalidRequestId;
    }
    // 异步获取数据
    NSString *prefix = [NSString stringWithFormat:kRCCityIDCheckPrefix,cityName];
    NSString *url = [RequestUtlity getFormattedUrl:prefix];
    
    KFLog(@"request url %@",url);


//    NSDictionary *userInfo = [[NSDictionary alloc] initWithObjects:[NSArray arrayWithObject:@"SearchAllCityTagJson"] forKeys:[NSArray arrayWithObject:@"FakeJson"]];
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[RCSearchCityIDDataModel class]
                                                     withDataDelegate:delegate];
}


-(int64_t)requestSearchTagListAtCity:(NSString *)cityid  withDelegate:(id<IManagerDelegate>)delegate
{
    if (nil == cityid) {
        return kInvalidRequestId;
    }
    // 异步获取数据
    NSString *urlSuffix = [NSString stringWithFormat:kRCAllCityUrlPrefix,cityid];
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    
    KFLog(@"request url %@",url);
//    NSDictionary *userInfo = [[NSDictionary alloc] initWithObjects:[NSArray arrayWithObject:@"SearchAllCityTagJson"] forKeys:[NSArray arrayWithObject:@"FakeJson"]];
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[RCSearchAllCityTagDataModel class]
                                                     withDataDelegate:delegate];
}

@end

